using System;using System.Data;using System.Data.SqlClient;using System.Collections.Generic;namespace MyWeb.Data{	public class GroupNewsDAL : SqlDataProvider	{		#region[GroupNews_GetById]		public List<GroupNews> GroupNews_GetById(string Id)		{			var list = new List<Data.GroupNews>();			using (SqlCommand dbCmd = new SqlCommand("sp_GroupNews_GetById", GetConnection()))			{				var obj = new Data.GroupNews();				dbCmd.CommandType = CommandType.StoredProcedure;				dbCmd.Parameters.Add(new SqlParameter("@Id", Id));				var dr = dbCmd.ExecuteReader();				if (dr.HasRows)				{					while (dr.Read())					{						list.Add(obj.GroupNewsIDataReader(dr));					}
                }
                dr.Close();
                //conn.Close();			}			return list;		}		#endregion		#region[GroupNews_GetByTop]		public List<GroupNews> GroupNews_GetByTop(string Top, string Where, string Order)		{			var list = new List<Data.GroupNews>();			using (var dbCmd = new SqlCommand("sp_GroupNews_GetByTop", GetConnection()))			{				var obj = new Data.GroupNews();				dbCmd.CommandType = CommandType.StoredProcedure;				dbCmd.Parameters.Add(new SqlParameter("@Top", Top));				dbCmd.Parameters.Add(new SqlParameter("@Where", Where));				dbCmd.Parameters.Add(new SqlParameter("@Order", Order));				var dr = dbCmd.ExecuteReader();				if (dr.HasRows)				{					while (dr.Read())					{						list.Add(obj.GroupNewsIDataReader(dr));					}
                }
                dr.Close();
                //conn.Close();			}			return list;		}		#endregion		#region[GroupNews_GetByAll]		public List<GroupNews> GroupNews_GetByAll(string Lang)		{			var list = new List<Data.GroupNews>();			using (var dbCmd = new SqlCommand("sp_GroupNews_GetByAll", GetConnection()))			{				var obj = new Data.GroupNews();				dbCmd.CommandType = CommandType.StoredProcedure;				dbCmd.Parameters.Add(new SqlParameter("@Lang", Lang));				var dr = dbCmd.ExecuteReader();				if (dr.HasRows)				{					while (dr.Read())					{						list.Add(obj.GroupNewsIDataReader(dr));					}
                }
                dr.Close();
                //conn.Close();			}			return list;		}		#endregion		#region[GroupNews_Paging]		public List<GroupNews> GroupNews_Paging(string CurentPage, string PageSize, string Lang)		{			var list = new List<Data.GroupNews>();			using (SqlCommand dbCmd = new SqlCommand("sp_GroupNews_Paging", GetConnection()))			{				var obj = new Data.GroupNews();				dbCmd.CommandType = CommandType.StoredProcedure;				dbCmd.Parameters.Add(new SqlParameter("@CurentPage", CurentPage));				dbCmd.Parameters.Add(new SqlParameter("@PageSize", PageSize));				dbCmd.Parameters.Add(new SqlParameter("@Lang", Lang));				var dr = dbCmd.ExecuteReader();				if (dr.HasRows)				{					while (dr.Read())					{						list.Add(obj.GroupNewsIDataReader(dr));					}
                }
                dr.Close();
                //conn.Close();			}		return list;		}		#endregion		#region[GroupNews_Insert]		public bool GroupNews_Insert(GroupNews data)		{			using (SqlCommand dbCmd = new SqlCommand("sp_GroupNews_Insert", GetConnection()))			{				dbCmd.CommandType = CommandType.StoredProcedure;				dbCmd.Parameters.Add(new SqlParameter("@Name", data.Name));				dbCmd.Parameters.Add(new SqlParameter("@Tag", data.Tag));				dbCmd.Parameters.Add(new SqlParameter("@Level", data.Level));				dbCmd.Parameters.Add(new SqlParameter("@Title", data.Title));				dbCmd.Parameters.Add(new SqlParameter("@Description", data.Description));				dbCmd.Parameters.Add(new SqlParameter("@Keyword", data.Keyword));				dbCmd.Parameters.Add(new SqlParameter("@Ord", data.Ord));				dbCmd.Parameters.Add(new SqlParameter("@Active", data.Active));				dbCmd.Parameters.Add(new SqlParameter("@Index", data.Index));				dbCmd.Parameters.Add(new SqlParameter("@Lang", data.Lang));				dbCmd.ExecuteNonQuery();			}			//Clear cache			System.Web.HttpContext.Current.Cache.Remove("GroupNews");			return true;		}		#endregion		#region[GroupNews_Update]		public bool GroupNews_Update(GroupNews data)		{			using (SqlCommand dbCmd = new SqlCommand("sp_GroupNews_Update", GetConnection()))			{				dbCmd.CommandType = CommandType.StoredProcedure;				dbCmd.Parameters.Add(new SqlParameter("@Id", data.Id));				dbCmd.Parameters.Add(new SqlParameter("@Name", data.Name));				dbCmd.Parameters.Add(new SqlParameter("@Tag", data.Tag));				dbCmd.Parameters.Add(new SqlParameter("@Level", data.Level));				dbCmd.Parameters.Add(new SqlParameter("@Title", data.Title));				dbCmd.Parameters.Add(new SqlParameter("@Description", data.Description));				dbCmd.Parameters.Add(new SqlParameter("@Keyword", data.Keyword));				dbCmd.Parameters.Add(new SqlParameter("@Ord", data.Ord));				dbCmd.Parameters.Add(new SqlParameter("@Active", data.Active));				dbCmd.Parameters.Add(new SqlParameter("@Index", data.Index));				dbCmd.Parameters.Add(new SqlParameter("@Lang", data.Lang));				dbCmd.ExecuteNonQuery();			}			//Clear cache			System.Web.HttpContext.Current.Cache.Remove("GroupNews");			return true;		}		#endregion		#region[GroupNews_Delete]		public bool GroupNews_Delete(string Id)		{			using (SqlCommand dbCmd = new SqlCommand("sp_GroupNews_Delete", GetConnection()))			{				dbCmd.CommandType = CommandType.StoredProcedure;				dbCmd.Parameters.Add(new SqlParameter("@Id", Id));				dbCmd.ExecuteNonQuery();			}			//Clear cache			System.Web.HttpContext.Current.Cache.Remove("GroupNews");			return true;		}		#endregion			}}